﻿using Nancy;
using Nancy.ErrorHandling;

namespace TaskManagementSystem
{
    public class StatusCodeHandler : IStatusCodeHandler
    {
        public void Handle(HttpStatusCode statusCode, NancyContext context)
        {
            context.Response.Contents = stream => ErrorResponse.FromMessagePath(stream, "Content/404.html");
        }

        public bool HandlesStatusCode(HttpStatusCode statusCode, NancyContext context)
        {
            return statusCode == HttpStatusCode.NotFound;
        }
    }
}